<?php

namespace app\subscribe;

use think\Event;
use app\model\Pay as Model;
// use EasyWeChat\Pay\Application;
use EasyWeChat\Factory;
// use EasyWeChat\Pay\Message;
use think\exception\HttpException;

class Pay
{
    private $app;
    public $params = [];

    public function __construct()
    {
        $this->app = Factory::payment(config('wechat.pay'));
    }
    public function onFinish(Model $model)
    {
        $model->info->save(['status' => $model->status]);
    }
    public function subscribe(Event $event)
    {
        $event->listen('PayFinish',[$this,'onFinish']);
    }
}
